home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14298 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.nask.org.pl!usenet
  2. From: flssoft@blue.maloka.waw.pl (Grzegorz (FLS))
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Passing command line params in Windows
  5. Date: Fri, 29 Mar 1996 19:10:59 GMT
  6. Organization: Research and Academic Computer Network
  7. Message-ID: <4jhcf7$jcu@bilbo.nask.org.pl>
  8. References: <4jc871$jg7@wdl1.wdl.loral.com>
  9. NNTP-Posting-Host: s111.maloka.waw.pl
  10. X-Newsreader: Forte Free Agent v0.46
  11.  
  12. Chuck Gantz <chuck.gantz&globalstar.loral.com> wrote:
  13.  
  14. >I have a win3.1 program that I've written, using OWL, that is designed to 
  15. >have only one copy of the program running at once, i.e. starting the 
  16. >program, then minimizing, then running again, just starts the original 
  17. >program at the point where it was minimized. The program accepts command 
  18. >line parameters. The question is, if you pass different command line 
  19. >parameters the second time you run the program, how do you tell the 
  20. >application to recalculate based on the new parameters?
  21.  
  22. Hi,
  23.  
  24. I do not know OWL, but I guess that you know how to get all parameters
  25. passed to <WinMain()> function.
  26.  
  27. When your program is launched the next time, you have a hPrevInstance
  28. != NULL. You can use <GetInstanceData()> function like that:
  29.  
  30. HWND hWnd ;
  31.  
  32.     GetInstanceData( hPrevInstance, ( NPSTR )&hWnd, sizeof( hWnd )) ;
  33.  
  34. and next, post to this window a message to recalculate like that:
  35.  
  36.     PostMessage( hWnd, WM_COMMAND, ID_RECALCULATE, lpCmdLine ) ;
  37.  
  38. Of course ID_RECALCULATE, it's a constant, you should define yourself.
  39.  
  40.  
  41. I hope it help you,
  42. Regards,
  43.  
  44.  
  45.